package com.jackstraw.jack_base.datasource.jpa.exception;

import com.jackstraw.jack_base.util.entity.response.ResultInterface;
import com.jackstraw.jack_base.util.exception.BadException;
import com.jackstraw.jack_base.util.exception.enums.ExceptionEnum;

/**
 * DataBase异常
 */
public class BadJpaException extends BadException {
    public BadJpaException() {
        super();
    }

    public BadJpaException(String errorKey, Object... obj) {
        super(errorKey, obj);
    }

    public BadJpaException(ResultInterface resultInterface) {
        super(resultInterface);
    }

    public BadJpaException(ResultInterface resultInterface, Throwable cause) {
        super(resultInterface, cause);
    }

    public BadJpaException(String errorKey) {
        super(errorKey);
    }

    public BadJpaException(String errorCode, String errorMsg) {
        super(errorCode(errorCode), errorMsg);
    }

    public BadJpaException(String errorCode, String errorMsg, Object... obj) {
        super(errorCode(errorCode), errorMsg, obj);
    }

    public BadJpaException(String errorCode, String errorMsg, Throwable cause) {
        super(errorCode(errorCode), errorMsg, cause);
    }

    public BadJpaException(String errorCode, String errorMsg, Throwable cause, Object... obj) {
        super(errorCode(errorCode), errorMsg, cause, obj);
    }


    public static String errorCode(String errorCode) {
        return BadException.bulidErrorCode(ExceptionEnum.JPA_DATASOURCE, errorCode);
    }

}
